package branch.feature.titlebar

import android.app.Activity
import android.os.Bundle
import android.widget.Toast
import com.example.myapplication.R
import com.hjq.bar.OnTitleBarListener
import com.hjq.bar.TitleBar

class MainActivity : Activity(){
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_sign_ss)
        initListener()
    }

    private fun initListener() {
        val sign_titlebar = findViewById<TitleBar>(R.id.sign_titlebar)

        sign_titlebar.setOnTitleBarListener(object: OnTitleBarListener{
            override fun onLeftClick(titleBar: TitleBar?) {
                // 退出程序
                finish()
            }

            override fun onTitleClick(titleBar: TitleBar?) {
                Toast.makeText(applicationContext,"点击标题", Toast.LENGTH_SHORT).show()
            }

            override fun onRightClick(titleBar: TitleBar?) {
                Toast.makeText(applicationContext,"点击设置", Toast.LENGTH_SHORT).show()

            }
        })
    }
}